﻿using System;
using System.Collections.Generic;

using IDAL.AuthModel;
using Model.AuthModel;
using Model.Base;
using DALFactory.AuthModel;
namespace BLL.AuthModel
{
    /// <summary>
    /// 通用组件，权限模型，业务层，功能
    /// </summary>
    public class FuncBLL
    {
        private IFunc dal = DataAccess.CreateFunc();

        /// <summary>
        /// 新增功能
        /// </summary>
        /// <param name="funcName">功能名字</param>
        /// <param name="funcDescription">功能描述</param>
        /// <param name="funcMenu">功能菜单</param>
        /// <returns></returns>
        public bool InsertFunc(string funcName, string funcDescription, string funcMenu) 
        {
            FuncInfo info = new FuncInfo();
            info.FuncName = funcName;
            info.FuncDescription = funcDescription;
            info.FuncMenu = funcMenu;
            return dal.InsertFunc(info);
        }

        /// <summary>
        /// 修改功能
        /// </summary>
        /// <param name="funcID">功能编号</param>
        /// <param name="funcName">功能名字</param>
        /// <param name="funcDescription">功能描述</param>
        /// <param name="funcMenu">功能菜单</param>
        /// <returns></returns>
        public bool UpdateFunc(int funcID, string funcName, string funcDescription, string funcMenu)
        {
            FuncInfo info = new FuncInfo();
            info.FuncID = funcID;
            info.FuncName = funcName;
            info.FuncDescription = funcDescription;
            info.FuncMenu = funcMenu;
            return dal.UpdateFunc(info);
        }

        /// <summary>
        /// 根据编号获取功能
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public FuncInfo GetFuncByID(int id) 
        {
            return dal.GetFuncByID(id);
        }

        /// <summary>
        /// 功能列表
        /// </summary>
        /// <returns></returns>
        public IList<FuncInfo> ListFunc() 
        {
            return dal.ListFunc(new BaseCondition());
        }
    }
}
